var sub = document.getElementById("paybtn");
VoteOption1Checked();
function VoteOption1Checked() {
    console.log(document.getElementById("VoteOption1").checked);
    if (document.getElementById("VoteOption1").checked) {
        sub.disabled = false;
    } else {
        sub.disabled = true;
    }
};
$("#selectBox .selectItem .select").click(function (event) {
    $(this).find('.dropmenu').toggle();
});
$("#selectBox .selectItem .select .dropmenu li").click(function (event) {
    var text = $(this).html();
    var txtojb = $(this).parent().siblings('.text');
    txtojb.html(text);
});
$(".fa-plus-square-o").click(function (event) {
    var input = $(this).siblings('.w50');
    var sprice = Number(input.attr('data-s'));
    var val = input.val();
    val++;
    input.val(val);
    var sum = val * sprice;
    $(this).parent().siblings('.coblue').find('span').html(sum);
});
$(".fa-minus-square-o").click(function (event) {
    var input = $(this).siblings('.w50');
    var sprice = Number(input.attr('data-s'));
    var val = Number(input.val());
    val && val--;
    input.val(val);
    var sum = val * sprice;
    $(this).parent().siblings('.coblue').find('span').html(sum);
});
$(".tabletype .w50").keyup(function (event) {
    var sprice = Number($(this).attr('data-s'));
    var val = Number($(this).val());
    var sum = val * sprice;
    $(this).parent().siblings('.coblue').find('span').html(sum);
});

$(".radiocss").click(function (event) {
    $(".payitem ").find('.fa').removeClass('fa-dot-circle-o').addClass('fa-circle-o');
    $(this).find('.fa').removeClass('fa-circle-o').addClass('fa-dot-circle-o');
});
$("#aggxy").click(function (event) {
    $(this).find('.fa').toggleClass('fa-check-square-o');
    $(this).find('.fa').toggleClass('fa-square-o');
});
$('#paybtn').click(function (event) {
    $("#modal").modal('show');
});


function payment() {
    var guid = $("#guid").val();
    var customer = $("#customer").val();
    $("#customerSpan").html(customer);
    var phoneNum = $("#phoneNum").val();
    $("#phoneNumSpan").html(phoneNum);
    var personNum = $("#personNum").val();
    var description = $("#description").val();
    var noticeWay = $("#noticeWay").val();
    $.ajax({
        url: "/rent/payment",
        type: "POST",
        dataType: "json",
        data: {guid: guid, customer: customer, phoneNum: phoneNum, description: description, noticeWay: noticeWay, coustomerNum: personNum},
        success: function (data) {
            location.reload();
        }
    })
}